﻿@model Resto.CostControl.Core.Material
@{
    ViewBag.Title = "品名维护";
    Layout = "~/Views/Shared/_LayoutForm.cshtml"; 
}
@using (Html.AjaxBeginForm())
{ 
    <div class="pageFormContent" style="width: 600px">
        @Html.HiddenFor(model => model.Id)
        @Html.DWZTextBoxFor(model => model.Name).Required()
        @Html.DWZDropDownListFor(model => model.Specification, "MaterialSpec")
        @Html.DWZTextBoxFor(model => model.Code).Required()
        @Html.DWZTextBoxFor(model => model.CurrentPrice).Number()
        @Html.DWZDropDownListFor(model => model.Unit, "MaterialUnit").Required()
        @Html.DWZTextBoxFor(model => model.SafeStorage).Number()
        @Html.DWZDropDownListFor(model => model.Category, "MaterialCategory").Required()
        @*@Html.DWZTextBoxFor(model => model.ActualSorage).Number()*@
        @Html.DWZDropDownListFor(model => model.Type, "MaterialType",new { onchange="Javascript:setHide(this.value)" }).Required()
        <div id="div2">
        @Html.DWZDropDownListFor(model => model.RawMaterialId, "Material")
        @Html.DWZTextBoxFor(model => model.ProcessRate).Number()
        </div>
        @Html.DWZTextAreaFor(model => model.Remark)
    </div>
}
@Html.FormBar()
<script language="javascript">
    $(document).ready(function () {
         setHide($("#Type").val());
    });

    function setHide(value) {
        if (value == "RawMaterial" || value == "" ||value == null) {
            $("#div2").hide();
        }
        else {
            $("#div2").show();
        }
    }


</script>